package simulator;

/**
 * This is a basic data structure to store information regarding a choice in the game.
 */
public class GameChoice {
	private GameAsset gameAsset;
	private GameMove task;
	
	protected GameChoice(GameMove task, GameAsset object) {
		this.task = task;
		this.gameAsset = object;
	}

	public GameAsset getGameAsset() {
		return gameAsset;
	}
	
	public GameMove getTask() {
		return task;
	}
	
	/**
	 * Overridden equals and hashCode to compare GameChoices using default java methods
	 */
	@Override
	public boolean equals(Object obj) {
		if(obj == null)	{
			return false;
		}
		if(this.getClass() != obj.getClass()) {
			return false;
		}
		GameChoice comparison = (GameChoice)obj;
		if(this.gameAsset != comparison.gameAsset || this.task != comparison.task) {
			return false;
		}

		return true;
	}
	
	@Override
	public int hashCode() {
		// Generate a unique-ish "hash" for the GameChoice
		return this.task.ordinal() * GameMove.values().length + this.gameAsset.ordinal();
	}
}
